import Vue from 'vue'
import  Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex);

const state = {
    menuList : [],
};
const getters = {};
const mutations = {
    // 保存菜单
    setMenuList(state, data) {
        state.menuList = data;
    },
};
const actions = {
    commitMenuList:({commit}, menuList) => commit('setMenuList', menuList)
};
const plugins = [createPersistedState()];

const module = {
    state,
    getters,
    mutations,
    actions,
    plugins
};

// 导出
const store = new Vuex.Store(module);
export default store
